home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / Palm Finder 2 / Src / Commanders / commander.h < prev    next >
Encoding:
Text File  |  2001-06-23  |  1.0 KB  |  40 lines

  1. // commander.h
  2.  
  3. #pragma once
  4. #define PILOT_PRECOMPILED_HEADERS_OFF
  5. #include <Pilot.h>
  6.  
  7. class commander {
  8. public:
  9.     static commander* s_top_commander;
  10.     static commander* s_default_super;
  11.     
  12.                                 commander(commander* in_super);
  13.                                 commander();
  14.     virtual                    ~commander();
  15.         
  16.                                 // command handling
  17.     static Boolean            dispatch_command(int in_eventID, void* io_data);    
  18.     Boolean                    do_cmd (int in_eventID, void* io_data);
  19.                                 
  20.                                 // command chain handling
  21.     static commander*    get_top_commander() { return s_top_commander; };
  22.     static void                set_top_commander(commander* in_commander) { s_top_commander = in_commander; };
  23.     static void                set_default_commander(commander* in_commander) { s_default_super = in_commander; };
  24.     
  25. protected:
  26.     commander*            m_super;
  27.     commander*            m_sub;
  28.     commander*            m_next;
  29.     
  30.     virtual Boolean        do_cmd_self (int in_eventID, void* io_data) = 0; // pure virtual
  31.  
  32.     commander*            get_sub() { return m_sub; };
  33.     void                        set_sub(commander* in_sub) { m_sub=in_sub; };
  34.  
  35.  
  36. protected:
  37.     void                        add();
  38.     void                        remove();
  39.     
  40. };